package edu.fourtwelve.client;

import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Christopher C. Hunt
 */
public class TransactionTableModel extends AbstractTableModel {

    private String[] columnNames = {"Transaction Description", "Withdrawl", "Deposit", "Balance"};
    private Object[][] data;

    public TransactionTableModel(int count) {
        this.data = new Object[count][4];
    }
    
    @Override
    public int getColumnCount() {
        return columnNames.length;
    }

    @Override
    public int getRowCount() {
        return data.length;
    }

    @Override
    public String getColumnName(int col) {
        return columnNames[col];
    }

    @Override
    public Object getValueAt(int row, int col) {
        return data[row][col];
    }

    @Override
    public Class getColumnClass(int c) {
        return "".getClass();
    }

    /*
     * Don't need to implement this method unless your table's editable.
     */
    @Override
    public boolean isCellEditable(int row, int col) {
        //Note that the data/cell address is constant,
        //no matter where the cell appears onscreen.
        return false;
    }

    /*
     * Don't need to implement this method unless your table's data can change.
     */
    @Override
    public void setValueAt(Object value, int row, int col) {
        data[row][col] = value;
        fireTableCellUpdated(row, col);
    }
}
